import React from 'react';
import CommonPage from '@/components/page/CommonPage';

const daoName = 'BaseMidoItem';
const columns: API.Column[] = [
  {
    title: '科目编号',
    dataIndex: 'ITNO',
    key: 'ITNO',
    width: 120,
    sorter: true,
    dispaly: true,
    filter: true,
  },
  {
    title: '科目名称',
    width: 150,
    sorter: true,
    key: 'ITNM',
    dataIndex: 'ITNM',
    dispaly: true,
    canEdit: true,
  },
  {
    title: '科目种类',
    width: 120,
    sorter: true,
    dataIndex: 'TPID',
    key: 'TPID',
    dispaly: true,
    filter: true,
    render: (TPID: any) => {
      if (TPID === 1) {
        return '公司类';
      } else if (TPID === 2) {
        return '交银类';
      } else if (TPID === 3) {
        return '投行类';
      } else if (TPID === 4) {
        return '同业类';
      } else {
        return '其它类';
      }
    },
  },
];
const controls: API.Control[] = [
  {
    name: 'ITNO',
    type: 'text',
    label: '科目编号',
    grid: 24 / 24,
    rules: [{ required: true, message: '科目编号不能为空' }],
  },
  {
    name: 'ITNM',
    label: '科目名称',
    grid: 24 / 24,
    type: 'text',
    rules: [{ required: true, message: '科目名称不能为空' }],
  },
  {
    name: 'TPID',
    type: 'select',
    label: '科目种类',
    grid: 24 / 24,
    dataType: 'number',
    options: [
      { value: 1, label: '公司类' },
      { value: 2, label: '交银类' },
      { value: 3, label: '投行类' },
      { value: 4, label: '同业类' },
      { value: 5, label: '其他类' },
    ],
    rules: [{ required: true, message: '科目种类不能为空' }],
  },
];
const BaseMidoItem: React.FC = () => {
  return (
    <CommonPage daoName={daoName} columns={columns} controls={controls} title="中收科目管理" />
  );
};

export default BaseMidoItem;
